home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games Extra 1996 September
/
Amiga Games Extra CD-ROM 9-1996.iso
/
rexx
/
checkarc.vzrx
< prev
next >
Wrap
Text File
|
1996-07-09
|
3KB
|
109 lines
/*
$VER: CheckArc.vzrx 1.01 (1.10.95)
© 1995 by Georg Hörmann
Template: CheckArc.vzrx ARC/A,QUIT/S
ARC: The filename (with path) of the archive.
QUIT: If VirusZ has been started from the script, you can
quit after checking by specifying this option.
If VirusZ is not running, it will be started from the
script (and quitted afterwards if requested).
Currently the type of archive is determined by the filename
suffixes ".lha", ".lzh" and ".lzx". This should usually work
properly as nobody ever removes the suffixes of archive names.
*/
/* Filenames of external programs */
Prog_VirusZ = "dh0:VZ"
Prog_LHA = "Boot:Tools/LHA"
Prog_LZX = "Boot:Tools/LZX"
Prog_Delete = "C:Delete"
TempPath = "RAM:TempArcDir"
options results
options failat 99
UseQuitFlag = "no"
parse upper arg ArcToCheck QuitFlag
if ArcToCheck = "" then do
say "No archive specified."
exit
end
TypeFlag = index(ArcToCheck,.LHA) + index(ArcToCheck,.LZH) + index(ArcToCheck,.LZX)
if TypeFlag = 0 then do
say "Archive not of required type."
exit
end
if ~show(ports,VIRUSZ_II.REXX) then do
say "Starting VirusZ..."
address command Prog_VirusZ
UseQuitFlag = "yes"
StartTime = time(seconds)
do while ~show(ports,VIRUSZ_II.REXX)
if time(seconds) - StartTime > 20 then do
say "Error loading VirusZ!"
exit
end
end
end
if exists(TempPath) then do
say "Deleting temporary directory..."
address command Prog_Delete ">NIL: <NIL:" TempPath ALL
if rc~=0 then do
say "Error deleting temporary directory!"
signal QuitVirusZ
end
end
TypeFlag = index(ArcToCheck,.LHA) + index(ArcToCheck,.LZH)
if TypeFlag ~= 0 then do
say "Extracting .LHA/.LZH archive..."
address command Prog_LHA ">NIL: <NIL: x "ArcToCheck TempPath"/"
if rc~=0 then do
say "Error extracting archive!"
signal DeleteTemp
end
end
else do
say "Extracting .LZX archive..."
address command Prog_LZX ">NIL: <NIL: x "ArcToCheck TempPath"/"
if rc~=0 then do
say "Error extracting archive!"
signal DeleteTemp
end
end
if exists(TempPath) then do
say "Checking archive contents..."
address VIRUSZ_II.REXX CHECKDIR TempPath DECREXEC DECRDATA
if rc=0 then say "Archive is clean."
if rc=5 then say "Archive contains virus(es)!"
if rc=10 then say "Error checking archive!"
end
DeleteTemp:
if exists(TempPath) then do
say "Deleting temporary directory..."
address command Prog_Delete ">NIL: <NIL:" TempPath ALL
if rc~=0 then do
say "Error deleting temporary directory!"
signal QuitVirusZ
end
end
QuitVirusZ:
if UseQuitFlag = "yes" then do
if QuitFlag = "QUIT" then do
say "Quitting VirusZ..."
address VIRUSZ_II.REXX QUIT
end
end